import {
    MenuFoldOutlined,
    UserOutlined,
    VideoCameraOutlined,
} from '@ant-design/icons';
import { FormattedMessage } from 'react-intl'
import Layout from '@/pages/Layout/index'
import Login from "@/pages/Login/index";
import Register from "@/pages/Register/index";
import Dashboard from "@/pages/Dashboard";
import GoodsForm from "@/pages/Goods/goodsForm";
import GoodsList from "@/pages/Goods/goodsList";
import User from "@/pages/User";

// 静态路由 没有权限
export const constantRoutes = [
    { path: '/', element: <Layout />, children: [] },
    { path: '/login', element: <Login />, children: [] },
    { path: '/register', element: <Register />, children: [] }
]

// 动态路由 有权限路由
export const asyncRoutes = [
    {
        key: 1001,
        path: "/dashboard",
        label: <FormattedMessage id='menu.dashboard' />,
        icon: <MenuFoldOutlined />,
        element: <Dashboard />,
        meta: {
            roles: ['admin', 'editor']
        },
    },
    {
        key: 1002,
        icon: <VideoCameraOutlined />,
        label: <FormattedMessage id='menu.good' />,
        meta: {
            roles: ['admin','editor']
        },
        children: [
            {
                key: 100201,
                path: "/goods/list",
                icon: null,
                label: <FormattedMessage id='menu.good.list' />,
                element: <GoodsList />
            },
            {
                key: 100202,
                path: "/goods/add",
                icon: null,
                label: <FormattedMessage id='menu.good.add' />,
                element: <GoodsForm />,
                hidden: true,
            },
            {
                key: 100203,
                path: "/goods/edit",
                icon: null,
                label: <FormattedMessage id='menu.good.edit' />,
                element: <GoodsForm />,
                hidden: true,
            }
        ]
    },
    {
        key: 1003,
        path: "/user",
        element: <User />,
        icon: <UserOutlined />,
        label: <FormattedMessage id='menu.user' />,
        meta: {
            roles: ['admin', 'editor']
        },
    }
]